package com.example.main;

import com.example.beans.Product;
import com.example.beans.Student;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class MainApp {
    public static void main(String[] args) {
        // 1. 加载Spring配置文件
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");

        // 2. 获取配置的bean
        Product product = (Product) context.getBean("product");
        Student student = (Student) context.getBean("student");

        // 3. 输出bean内容
        System.out.println("Product bean: " + product);
        System.out.println("Student bean: " + student);
    }
}